package com.example.boardroom.demo;

import android.content.Intent;
import android.os.Bundle;
import android.printservice.PrintService;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.blankj.utilcode.util.AppUtils;
import com.blankj.utilcode.util.DeviceUtils;
import com.blankj.utilcode.util.ServiceUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.example.boardroom.R;
import com.example.boardroom.appusagestatistics.AppUsageStatisticsActivity;
import com.example.boardroom.demo.custom.NetPrinter;
import com.example.boardroom.demo.times.HardwareService;
import com.example.boardroom.demo.times.TimesActivity;
import com.example.boardroom.demo.times.TimesActivity2;
import com.example.boardroom.newItems.HardwareControlActivity;

import java.util.ArrayList;
import java.util.List;

import butterknife.ButterKnife;

public class MainActivity4 extends AppCompatActivity {
    Button btn_wangye, btn_dengkong, btn_app_time, btn_app_time2, btn_app_time3, btn_app_time4, btn_app_time5;
    TextView tv_uid;

    //Component  Inject  provide   dependencies  Injector
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main4);
        ButterKnife.bind(MainActivity4.this);
//        if (!ServiceUtils.isServiceRunning(HardwareService.class)) {
//            ServiceUtils.startService(HardwareService.class);
//        }
        tv_uid = findViewById(R.id.tv_uid);
        tv_uid.setText("获取唯一设备ID: " + DeviceUtils.getUniqueDeviceId() + "");
        btn_wangye = findViewById(R.id.btn_wangye);
        btn_dengkong = findViewById(R.id.btn_dengkong);
        btn_app_time = findViewById(R.id.btn_app_time);
        btn_app_time2 = findViewById(R.id.btn_app_time2);
        btn_app_time3 = findViewById(R.id.btn_app_time3);
        btn_app_time4 = findViewById(R.id.btn_app_time4);
        btn_app_time5 = findViewById(R.id.btn_app_time5);
        btn_app_time5.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MainActivity4.this, MPAndroidChartActivity.class));
            }
        });
        btn_wangye.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MainActivity4.this, WebViewActivity.class));
            }
        });
        btn_dengkong.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MainActivity4.this, MainActivity3.class));
            }
        });
        btn_app_time.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MainActivity4.this, AppUsageStatisticsActivity.class));
            }
        });
        btn_app_time2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MainActivity4.this, TimesActivity.class));
            }
        });
        btn_app_time3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MainActivity4.this, HardwareControlActivity.class));
            }
        });
        btn_app_time4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MainActivity4.this, TimesActivity2.class));
            }
        });
        xxx();
    }

    private void xxx() {
        NetPrinter netPrinter = new NetPrinter();
        boolean open = netPrinter.Open("192.168.1.88", 9100);
        ToastUtils.showLong(open?"打开":"失败");
    }


}
